#:import Window kivy.core.window.Window
#:import StiffScrollEffect kivymd.effects.stiffscroll.StiffScrollEffect
#:import MagicBehavior kivymd.uix.behaviors.MagicBehavior
#:import environ os.environ


<MDIconMagicButton@MagicBehavior+MDIconButton>
    theme_text_color: "Custom"
    text_color: 1, 1, 1, 1


<PlanItem>
    adaptive_size: True
    on_touch_down: if self.collide_point(*args[1].pos): root.press_on_plan(root)

    MDBoxLayout:
        size_hint: None, None
        size: "40dp", "40dp"

        canvas.before:
            Color:
                rgba: root.color_select
            BorderImage
                pos: self.pos
                size: self.size
                source: f"{environ['SHRINE_ROOT']}/assets/images/border.png"

        Label:
            text_size: self.size
            halign: 'center'
            valign: 'middle'
            text: root.text_item
            markup: True
            color: 0, 0, 0, 1


<MoreInformation>
    padding: "25dp"
    adaptive_height: True

    MDLabel:
        adaptive_size: True
        markup: True
        color: root.theme_cls.text_color
        text:
            "- Beautiful 3D Design Dial, with '7' marking\n" \
            "- Comfortable Soft Leather Watch Band\n" \
            "- Durable stainless steel buckle\n" \
            "- Precise Quartz movement for accurate time keeping\n" \
            "- Comfortable for Everyday Wear\n\n" \

            "[color={COLOR}][b]WARRANTY INFORMATION:[/b][/color]\n" \
            "- For defective products, buyers may return the watch for refund within\n" \
            "  the Zalora PH return period (within 30 days after delivery).\n\n" \

            "[color={COLOR}][b]THIS WARRANTY DOES NOT COVER:[/b][/color]\n" \
            "- Damage resulting from impact, accidents, mishandling, or abuse (dents, crushing, knocks or impacts).\n" \
            "- Loss of water resistance after 24 months without proper and documented maintenance.".format(\
            COLOR=colors["BlueGray"]["500"])


<ProductScreen>
    name: "product screen"
    opacity: 0
    md_bg_color: 1, 1, 1, 1

    ScrollView:
        effect_cls: StiffScrollEffect

        MDList:
            cols: 1
            padding: 0

            FitImage:
                id: previous_image
                size_hint: None, None
                size: Window.width, dp(Window.height * 35 // 100)

            MDBoxLayout:
                padding: "25dp"
                adaptive_height: True

                MDLabel:
                    text: "Chronomart"
                    font_style: "H6"
                    adaptive_height: True

                Widget:
                    size_hint_x: .1

                MDLabel:
                    text: "$380"
                    halign: "right"
                    adaptive_height: True

            MDBoxLayout:
                adaptive_height: True
                padding: "25dp", 0, "25dp", 0

                MDLabel:
                    text:
                        "FEYERT Logo Office Lady Fashion Small Dial Stainless " \
                        "Steel Leather Strap Wrist Watch"
                    adaptive_height: True

            MDBoxLayout:
                id: expansion_panel_box
                adaptive_height: True

            MDBoxLayout:
                adaptive_height: True
                padding: "25dp", "25dp", 0, 0

                MDLabel:
                    text: "Select size"
                    adaptive_height: True
                    font_style: "H6"

            BoxLayout:
                size_hint_y: None
                height: "80dp"
                padding: "25dp", "25dp", "25dp", 0

                ScrollView
                    bar_width: 0

                    MDGridLayout:
                        id: box
                        rows: 1
                        spacing: "10dp"
                        padding: "5dp"
                        adaptive_width: True

                        PlanItem:
                            text_item: '12'
                        PlanItem:
                            text_item: '14'
                        PlanItem:
                            text_item: '16'
                        PlanItem:
                            text_item: '18'
                        PlanItem:
                            text_item: '20'
                        PlanItem:
                            text_item: '22'
                        PlanItem:
                            text_item: '24'
                        PlanItem:
                            text_item: '26'
                        PlanItem:
                            text_item: '28'

    MDBoxLayout:
        y: previous_image.height - self.height
        padding: "5dp"
        adaptive_height: True
        pos_hint: {"top": 1}
        md_bg_color: 0, 0, 0, 0

        MDIconMagicButton:
            icon: "close"
            on_release: root.hide_product_screen()

        Widget:

        MDIconMagicButton:
            icon: "cart-plus"
            on_release: print('on_cart')

        MDIconMagicButton:
            icon: "heart-outline"
            on_release:
                self.grow()
                self.icon = "heart" if self.icon == "heart-outline" else "heart-outline"
